package string;

/**
 * String支持正则表达式的方法一:
 * boolean matches
 */
public class MatchDemo {
    public static void main(String[] args) {
        String email ="fanchaun#qi123@yahoo.com.cn";
        String regex ="[a-zA-Z0-9_]+@[a-zA-Z0-9]+(\\.[a-zA-Z]+)+";
        boolean flag =email.matches(regex);
        System.out.println(flag?"验证通过":"验证失败");
    }
}
